cmake_minimum_required(VERSION 3.0.2)
project(mapping)

# 查找 catkin 并确保其可用
find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  sensor_msgs
  tf2
  tf2_eigen
  pcl_ros
  pcl_conversions
  # 其他可能需要的组件
)

# 确保 PCL 可用
find_package(PCL 1.8 REQUIRED)

include_directories(include ${catkin_INCLUDE_DIRS} ${PCL_INCLUDE_DIRS})

link_directories(${PCL_LIBRARY_DIRS})
add_definitions(${PCL_DEFINITIONS})

# 添加您的源文件
set(SOURCE_FILES
  src/sub_sensor.cc
  # 其他源文件
)

# 包的名称（与项目名称相同）
catkin_package(
  INCLUDE_DIRS include
  LIBRARIES ${PROJECT_NAME}
  CATKIN_DEPENDS roscpp sensor_msgs tf2 tf2_eigen pcl_ros pcl_conversions
  # 依赖的其他包
)

# 定义可执行文件
add_executable(sub_sensor ${SOURCE_FILES})
# 链接您的可执行文件到 catkin 和 PCL 库
target_link_libraries(sub_sensor
  ${catkin_LIBRARIES}
  ${PCL_LIBRARIES}
  # 其他可能需要的库
)

# 如果您使用 Eigen，确保启用 C++11
if(NOT "${Eigen3_VERSION}" VERSION_LESS "3.1.0")
  target_compile_definitions(sub_sensor PUBLIC -DEIGEN_NO_DEBUG)
endif()

target_compile_options(sub_sensor PUBLIC -std=c++11)
